1
00:00:05,074 --> 00:00:06,040
[ambient noise]

2
00:00:06,040 --> 00:00:08,818
My car knows when it’s wet.

3
00:00:08,818 --> 00:00:11,508
That’s right,&nbsp;it’s got automatic windshield wipers.

4
00:00:11,508 --> 00:00:15,002
When they’re set to automatic, and the car&nbsp;gets wet, they wipe.

5
00:00:15,002 --> 00:00:16,668
How it know that?

6
00:00:16,668 --> 00:00:18,397
It’s actually really simple.

7
00:00:18,397 --> 00:00:19,704
If you look&nbsp;at the windshield,

8
00:00:19,704 --> 00:00:22,915
you’ll notice an area near the top center which is black.

9
00:00:22,915 --> 00:00:28,332
And if you&nbsp;look closelier you’ll see the component
the car uses to determine windshield wetness.

10
00:00:28,761 --> 00:00:30,126
Oh, the&nbsp;camera?

11
00:00:30,126 --> 00:00:33,027
No, it's not the camera - that’d be silly!

12
00:00:33,080 --> 00:00:39,295
Then you’d have to devote some precious clock&nbsp;cycles
away from the already wildly complicated&nbsp;computer vision tasks

13
00:00:39,295 --> 00:00:42,220
which help keep the car&nbsp;centered in its lane.

14
00:00:42,220 --> 00:00:43,459
That seems like a weird decision

15
00:00:43,459 --> 00:00:47,739
and I don’t even know how well that&nbsp;could possibly work
no matter how many software updates you throw at it.

16
00:00:48,614 --> 00:00:51,596
No, I’m not alluding to anything&nbsp;specific,
why on Earth would you think that?

17
00:00:51,596 --> 00:00:59,767
Right above that camera which looks forward at the&nbsp;road
you’ll see a little circular spot with some spots within the spot and that, viewers,

18
00:00:59,767 --> 00:01:01,712
is the&nbsp;rain sensor.

19
00:01:01,712 --> 00:01:04,841
Look, I get it wet - and the car wipes!

20
00:01:04,841 --> 00:01:06,469
But two can play at that game.

21
00:01:07,721 --> 00:01:11,882
You may&nbsp;think this is wildly complicated and expensive technology

22
00:01:11,882 --> 00:01:18,912
but actually it’s just two of the&nbsp;simplest electronic components you can imagine working together in a very clever way.

23
00:01:18,912 --> 00:01:25,207
Below the&nbsp;dark portions of the rain sensor are
infrared LEDs shining light up into the glass,

24
00:01:25,207 --> 00:01:29,190
and adjacent&nbsp;to them are photodiodes which detect that light.

25
00:01:29,190 --> 00:01:31,731
Now, that bright spot at the bottom?

26
00:01:31,731 --> 00:01:33,842
That’s&nbsp;not actually part of the rain sensor.

27
00:01:33,920 --> 00:01:38,576
It’s an ambient light sensor used to control the&nbsp;car’s headlights automatically.

28
00:01:38,576 --> 00:01:41,515
The two components just live in the same assembly.

29
00:01:41,515 --> 00:01:44,734
The parts that&nbsp;make up the rain sensor aren’t really visible

30
00:01:44,734 --> 00:01:50,433
because they’re below a filter which blocks&nbsp;visible light
and thus it appears black to our eyes.

31
00:01:51,771 --> 00:01:55,143
That’s strange, didn’t we just encounter that with&nbsp;stovetops?

32
00:01:55,143 --> 00:01:57,527
Weird connections happening lately.

33
00:01:57,527 --> 00:02:02,772
To demonstrate how that detects rain,
I’ll&nbsp;use a piece of glass and a laser pointer.

34
00:02:02,772 --> 00:02:06,614
If I shine the laser up at the glass at about a&nbsp;45 degree angle,

35
00:02:06,614 --> 00:02:11,420
you’ll notice that a spot of laser light is reflected back down towards the table.

36
00:02:11,420 --> 00:02:14,515
I’ll put a piece of paper there to make it more visible.

37
00:02:14,515 --> 00:02:17,408
Now watch what happens when I get the&nbsp;glass wet.

38
00:02:18,334 --> 00:02:19,786
Not a whole lot.

39
00:02:20,386 --> 00:02:21,648
That’s a bummer.

40
00:02:21,648 --> 00:02:27,507
Ah, but this isn’t actually an accurate&nbsp;demonstration
of the principles involved in the rain sensor.

41
00:02:27,507 --> 00:02:31,393
Rather than look at the&nbsp;light reflected back downward by the glass,

42
00:02:31,393 --> 00:02:36,554
let’s look at the spot produced above the glass by&nbsp;
the laser light which makes it through.

43
00:02:36,554 --> 00:02:38,014
Now watch closely.

44
00:02:38,460 --> 00:02:41,036
Did you see that? It moved.

45
00:02:41,036 --> 00:02:48,991
That happened&nbsp;because the water on top of the glass
changed the angle of refraction as light left the glass.

46
00:02:48,991 --> 00:02:53,397
Now,&nbsp;like some politicians, I’m really not really good at the whole optics thing

47
00:02:53,397 --> 00:02:55,858
so I’m not getting too deep&nbsp;into the weeds here.

48
00:02:55,858 --> 00:03:01,042
But as light passes from one medium to another,
its speed actually changes

49
00:03:01,042 --> 00:03:05,768
and because of… reasons that means it appears to change direction.

50
00:03:05,768 --> 00:03:07,967
That concept is known as&nbsp;refraction.

51
00:03:07,967 --> 00:03:12,485
And the refraction index of water is different from that of air.

52
00:03:12,485 --> 00:03:22,502
That means the change&nbsp;in speed and thus change in refraction angle is different between light passing from glass into&nbsp;air and light passing from glass into water.

53
00:03:22,880 --> 00:03:25,946
The rain sensor, though, is entirely under the&nbsp;glass

54
00:03:25,946 --> 00:03:29,779
so it’s not as if it can directly detect that change.

55
00:03:29,779 --> 00:03:34,080
Instead, it leverages the effect of&nbsp;total internal reflection.

56
00:03:34,080 --> 00:03:40,090
If you’ve ever gone swimming in a pool with goggles on and looked&nbsp;up at the surface of the water while submerged,

57
00:03:40,090 --> 00:03:44,061
you may have noticed that it looks like&nbsp;a mirror from shallow angles.

58
00:03:44,061 --> 00:03:46,487
Here’s some stock footage to illustrate.

59
00:03:46,487 --> 00:03:54,067
That’s&nbsp;total internal reflection at work - the water directly above you
transmits light&nbsp;just fine and you can see through it,

60
00:03:54,067 --> 00:04:00,377
but there’s a critical angle at which the
air-water interface will reflect all light back down

61
00:04:00,377 --> 00:04:04,481
and since it’s smooth like&nbsp;glass, it looks like a mirror.

62
00:04:04,481 --> 00:04:07,975
So now - how can the rain sensor take advantage&nbsp;of that?

63
00:04:07,975 --> 00:04:11,374
Well, first, since the module isn’t part of the glass,

64
00:04:11,374 --> 00:04:20,067
we need an optical interface&nbsp;material to couple the sensor to the glass
and remove the air-to-glass optical interface on the bottom.

65
00:04:20,067 --> 00:04:26,184
That takes the form of a sticky gel which, now that it’s in-place, you can’t see.

66
00:04:26,184 --> 00:04:29,082
Which, really, is the point - when it’s doing its job,

67
00:04:29,082 --> 00:04:31,842
the sensor and the glass become&nbsp;one

68
00:04:31,842 --> 00:04:33,854
(from an optical perspective).

69
00:04:33,854 --> 00:04:37,788
Now the key is that the infrared LEDs that&nbsp;we talked about earlier

70
00:04:37,788 --> 00:04:44,476
are shining up at the glass just shallow
of the critical angle of&nbsp;total internal reflection.

71
00:04:44,476 --> 00:04:51,893
So, all the light they produce will simply bounce off
the top surface of the the glass and&nbsp;head back downward.

72
00:04:51,893 --> 00:04:55,884
And, at the other end of that beam of light, is a photodiode.

73
00:04:55,884 --> 00:04:59,982
That will then&nbsp;detect the light being generated by the LED.

74
00:04:59,982 --> 00:05:03,291
And to make sure it’s detecting that light and&nbsp;not something else,

75
00:05:03,291 --> 00:05:09,157
the LEDs are actually rapidly blinking
and the photodiode is looking for that&nbsp;pattern of blinks.

76
00:05:09,157 --> 00:05:16,948
That’s a simpler way of saying the LEDs are producing
a specific modulated&nbsp;signal that the photodiode is tuned to detect.

77
00:05:16,948 --> 00:05:24,925
But because the angle between the photodiode and&nbsp;
the LED is so close to the critical angle of total internal reflection,

78
00:05:24,925 --> 00:05:33,133
if conditions should change&nbsp;the intensity of that signal
being received by the photodiode will also change.

79
00:05:33,133 --> 00:05:34,472
What condition?

80
00:05:34,472 --> 00:05:36,184
Condition wet.

81
00:05:36,184 --> 00:05:44,455
Water on the glass, as we saw in the earlier demo,
changes the refraction angle&nbsp;because its refractive index is different from air.

82
00:05:44,455 --> 00:05:50,056
And it will change it just enough to break&nbsp;the effect of total internal reflection.

83
00:05:50,056 --> 00:05:58,015
Wet glass will allow some of the light produced by the LEDs&nbsp;
to actually escape and be transmitted through to the outside surface.

84
00:05:58,015 --> 00:06:03,132
Which in turn means there’s&nbsp;less light bouncing down
to the photodiode to be detected,

85
00:06:03,132 --> 00:06:06,582
so the signal it was receiving&nbsp;begins to diminish.

86
00:06:06,582 --> 00:06:14,330
And, with a little logic circuitry and programming, you can use that loss&nbsp;of signal as a measurement of windshield wetness.

87
00:06:14,330 --> 00:06:17,058
And honestly… that’s it!

88
00:06:17,058 --> 00:06:18,491
It’s that simple.

89
00:06:18,491 --> 00:06:24,111
The sensor starts to see the signal from the LED drop out
so it says to the windshield&nbsp;wiper motor -

90
00:06:24,111 --> 00:06:25,321
wipe.

91
00:06:25,321 --> 00:06:29,738
And the wetter the glass,
the more the signal drops, so the more&nbsp;it wipes.

92
00:06:29,738 --> 00:06:37,064
And you’ll notice the sensor is deliberately placed in the path of&nbsp;the windshield wipers so they clear the glass with every wipe.

93
00:06:37,064 --> 00:06:45,155
That allows the&nbsp;logic to get some sense of how hard it might be raining
based on how quickly the&nbsp;signal drops out after every wiping event.

94
00:06:45,240 --> 00:06:48,594
The only other complexity here is&nbsp;calibration.

95
00:06:48,594 --> 00:06:55,251
Every time the sensor powers up, it’s got to pick a baseline&nbsp;
signal level which it deems “dry.”

96
00:06:55,251 --> 00:07:00,880
Yet, if you are out and about in the rain
and you&nbsp;turn your car on with the windshield already wet,

97
00:07:00,880 --> 00:07:05,095
it’s going to start out with some lower signal&nbsp;level than typical.

98
00:07:05,095 --> 00:07:12,080
So, somebody smarter than me probably established
a minimum signal&nbsp;dropout level which always causes a wipe,&nbsp;&nbsp;

99
00:07:12,080 --> 00:07:17,121
and in fact I’m certain I’ve encountered the&nbsp;
car do a single wipe after turning it on

100
00:07:17,121 --> 00:07:19,889
when it didn’t really need to.

101
00:07:19,889 --> 00:07:23,680
But then it can reset&nbsp;its calibration after that wiping event.

102
00:07:23,680 --> 00:07:28,117
And, there’s another trick up its sleeve,
and it's&nbsp;my very favorite one:

103
00:07:28,117 --> 00:07:29,520
having two of them.

104
00:07:30,160 --> 00:07:33,109
There are actually two sensor assemblies under here.

105
00:07:33,109 --> 00:07:37,654
You can barely make out the infrared light in this smartphone camera footage.

106
00:07:37,654 --> 00:07:39,751
You'll see there's two spots.

107
00:07:39,751 --> 00:07:44,223
If the windshield&nbsp;is dry, the two sensors should see very similar signals

108
00:07:44,223 --> 00:07:50,352
but if there’s even just a tiny bit of&nbsp;water on top of one of them,
 or differing amounts between the two,

109
00:07:50,352 --> 00:07:56,250
then the two signals will be&nbsp;very different
and it will know immediately that the windshield is wet.

110
00:07:56,250 --> 00:07:58,988
Which calibration&nbsp;method is it actually using?

111
00:07:58,988 --> 00:08:00,438
I do not know.

112
00:08:00,438 --> 00:08:09,360
And if you’ve never lived with a car with&nbsp;automatic wipers,
you may wish to know they are great but not exactly perfect.

113
00:08:09,360 --> 00:08:15,646
You are afforded&nbsp;a sensitivity adjustment on the wiper stalk,
so you can fine-tune its behavior to your&nbsp;liking.

114
00:08:15,646 --> 00:08:19,883
But while the wipers pretty much always come on when they need to,

115
00:08:19,883 --> 00:08:27,665
sometimes they&nbsp;go absolutely nuts when it’s barely raining
or they get a little lazy in a sudden downpour.

116
00:08:27,665 --> 00:08:34,252
Lucky&nbsp;for me, if that happens all I have to do
is just slap this stalk which is right next to&nbsp;my hand on the steering wheel

117
00:08:34,252 --> 00:08:37,167
and the wipers will come on full-steam!

118
00:08:37,167 --> 00:08:39,287
Handy user interface,&nbsp;those stalks.

119
00:08:39,287 --> 00:08:42,173
They’re always there and muscle memory takes over!

120
00:08:42,173 --> 00:08:45,788
I’m pro-stalks,&nbsp;is what I’m saying. It’s a good idea.

121
00:08:45,788 --> 00:08:53,623
What’s less of a good idea, though, is the&nbsp;Konami-code like trick
I had to look up just to change my car’s wiper blades.

122
00:08:53,623 --> 00:09:00,993
The hood&nbsp;blocks you from lifting the wiper arms
so you need them to stop in the up position in order to&nbsp;change them.

123
00:09:00,993 --> 00:09:06,199
and despite digging through all the settings menus
I couldn’t find a “change wipers”&nbsp;option.

124
00:09:06,199 --> 00:09:12,399
So I tried just switching the car off with the wipers in the up position,
y'know just time it right, using the power&nbsp;button,

125
00:09:12,399 --> 00:09:15,527
but it outsmarted me and parked them anyway.

126
00:09:15,527 --> 00:09:23,154
It turns out what you have to do is turn&nbsp;the car off and then hold the wiper stalk up in the mist position for a few moments

127
00:09:23,154 --> 00:09:26,102
and then the&nbsp;car will do this.

128
00:09:26,102 --> 00:09:28,640
Is this procedure in the owner’s manual?

129
00:09:30,240 --> 00:09:33,640
Yes, but who looks there for information?

130
00:09:33,640 --> 00:09:37,824
I usually like to end my videos with&nbsp;something akin to a moral.

131
00:09:37,824 --> 00:09:41,015
In that vein, the first lesson today is for me

132
00:09:41,015 --> 00:09:43,778
and that&nbsp;is to read the freaking manual!

133
00:09:43,778 --> 00:09:49,557
There’s even an index in here and finding the appropriate&nbsp;
information would have taken me mere moments.

134
00:09:49,557 --> 00:09:53,471
People worked hard on this thing&nbsp;and I just… completely ignored it!

135
00:09:53,471 --> 00:09:56,848
So don’t ignore the manuals in your life.

136
00:09:56,848 --> 00:09:58,556
And the second moral is…

137
00:09:58,556 --> 00:10:01,519
don’t ignore what you can do with a few simple components.

138
00:10:01,519 --> 00:10:03,514
Software isn’t everything.

139
00:10:04,286 --> 00:10:07,310
That’s&nbsp;not directed at any organization in particular, mind you.

140
00:10:07,310 --> 00:10:08,992
Just something to keep in&nbsp;mind.

141
00:10:09,609 --> 00:10:11,118
Did I get to 10 minutes yet?

142
00:10:11,958 --> 00:10:14,503
♫ internally smooth jazz ♫

143
00:10:15,326 --> 00:10:20,857
Thanks, by the way, to Jason, a supporter&nbsp;on Patreon,
for recommending this video topic.

144
00:10:20,857 --> 00:10:27,793
That happened a long time ago&nbsp;and I’m pretty certain at least one other person has suggested this in the&nbsp;meantime

145
00:10:27,793 --> 00:10:30,549
so if I forgot who you were, I’m sorry.

146
00:10:30,549 --> 00:10:33,046
There’s just too many&nbsp;bimetallic strips getting in the way.

147
00:10:34,675 --> 00:10:37,528
That’s right, it’s got automatic…&nbsp;the thing didn’t start.

148
00:10:37,528 --> 00:10:40,997
You’ll notice that the spot&nbsp;of laser light is re… oh.

149
00:10:40,997 --> 00:10:44,038
…conditions should change, the intensity&nbsp;of a-

150
00:10:45,530 --> 00:10:48,841
Ooh, I needed a comma for my sake

151
00:10:48,841 --> 00:10:51,883
...critical angle of total internal reflection

152
00:10:51,883 --> 00:10:52,948
[annoyance at outside noise]

153
00:10:52,948 --> 00:10:55,956
...it’s got to pick a baseline&nbsp;signal lever.

154
00:10:55,956 --> 00:10:56,806
Signal.

155
00:10:56,806 --> 00:10:57,619
Level.

156
00:10:57,619 --> 00:11:00,113
...had to look, oh yeah I forgo&nbsp;ohyeahIgottagetthething!

157
00:11:01,176 --> 00:11:05,751
You mean to say all you need is an LED, a photodiode, and a bit of adhesive to take the task of detecting rain away from a sophisticated computer vision system?

158
00:11:05,751 --> 00:11:08,288
And that this was a technology available back in the nineties?

159
00:11:08,288 --> 00:11:12,797
That sounds unpossible, I mean if there were a better way to do things, surely it would only come from the halls of one particular company and not anyone else.

160
00:11:13,003 --> 00:11:15,188
This section is usually for puns but today I chose vicious sarcasm.

161
00:11:15,188 --> 00:11:17,076
Not directed at any particular organization, of course :)

